/*
 * The Selling Partner API for Sellers
 *
 * The [Selling Partner API for Sellers](https://developer-docs.amazon.com/sp-api/docs/sellers-api-v1-reference) (Sellers API) provides essential information about seller accounts, such as:  - The marketplaces a seller can list in - The default language and currency of a marketplace - Whether the seller has suspended listings  Refer to the [Sellers API reference](https://developer-docs.amazon.com/sp-api/docs/sellers-api-v1-reference) for details about this API's operations, data types, and schemas.
 *
 * The version of the OpenAPI document: v1
 * Generated by: https://github.com/openapitools/openapi-generator.git
 */


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = software.amzn.spapi.Client.OpenAPIDateConverter;

namespace software.amzn.spapi.Model.sellers.v1
{
    /// <summary>
    /// Information about an Amazon marketplace where a seller can list items and customers can view and purchase items.
    /// </summary>
    [DataContract(Name = "Marketplace")]
    public partial class Marketplace : IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Marketplace" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected Marketplace() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="Marketplace" /> class.
        /// </summary>
        /// <param name="id">The encrypted marketplace value. (required).</param>
        /// <param name="name">The marketplace name. (required).</param>
        /// <param name="countryCode">The ISO 3166-1 alpha-2 format country code of the marketplace. (required).</param>
        /// <param name="defaultCurrencyCode">The ISO 4217 format currency code of the marketplace. (required).</param>
        /// <param name="defaultLanguageCode">The ISO 639-1 format language code of the marketplace. (required).</param>
        /// <param name="domainName">The domain name of the marketplace. (required).</param>
        public Marketplace(string id = default(string), string name = default(string), string countryCode = default(string), string defaultCurrencyCode = default(string), string defaultLanguageCode = default(string), string domainName = default(string))
        {
            // to ensure "id" is required (not null)
            if (id == null)
            {
                throw new ArgumentNullException("id is a required property for Marketplace and cannot be null");
            }
            this.Id = id;
            // to ensure "name" is required (not null)
            if (name == null)
            {
                throw new ArgumentNullException("name is a required property for Marketplace and cannot be null");
            }
            this.Name = name;
            // to ensure "countryCode" is required (not null)
            if (countryCode == null)
            {
                throw new ArgumentNullException("countryCode is a required property for Marketplace and cannot be null");
            }
            this.CountryCode = countryCode;
            // to ensure "defaultCurrencyCode" is required (not null)
            if (defaultCurrencyCode == null)
            {
                throw new ArgumentNullException("defaultCurrencyCode is a required property for Marketplace and cannot be null");
            }
            this.DefaultCurrencyCode = defaultCurrencyCode;
            // to ensure "defaultLanguageCode" is required (not null)
            if (defaultLanguageCode == null)
            {
                throw new ArgumentNullException("defaultLanguageCode is a required property for Marketplace and cannot be null");
            }
            this.DefaultLanguageCode = defaultLanguageCode;
            // to ensure "domainName" is required (not null)
            if (domainName == null)
            {
                throw new ArgumentNullException("domainName is a required property for Marketplace and cannot be null");
            }
            this.DomainName = domainName;
        }

        /// <summary>
        /// The encrypted marketplace value.
        /// </summary>
        /// <value>The encrypted marketplace value.</value>
        [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)]
        public string Id { get; set; }

        /// <summary>
        /// The marketplace name.
        /// </summary>
        /// <value>The marketplace name.</value>
        [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
        public string Name { get; set; }

        /// <summary>
        /// The ISO 3166-1 alpha-2 format country code of the marketplace.
        /// </summary>
        /// <value>The ISO 3166-1 alpha-2 format country code of the marketplace.</value>
        [DataMember(Name = "countryCode", IsRequired = true, EmitDefaultValue = true)]
        public string CountryCode { get; set; }

        /// <summary>
        /// The ISO 4217 format currency code of the marketplace.
        /// </summary>
        /// <value>The ISO 4217 format currency code of the marketplace.</value>
        [DataMember(Name = "defaultCurrencyCode", IsRequired = true, EmitDefaultValue = true)]
        public string DefaultCurrencyCode { get; set; }

        /// <summary>
        /// The ISO 639-1 format language code of the marketplace.
        /// </summary>
        /// <value>The ISO 639-1 format language code of the marketplace.</value>
        [DataMember(Name = "defaultLanguageCode", IsRequired = true, EmitDefaultValue = true)]
        public string DefaultLanguageCode { get; set; }

        /// <summary>
        /// The domain name of the marketplace.
        /// </summary>
        /// <value>The domain name of the marketplace.</value>
        [DataMember(Name = "domainName", IsRequired = true, EmitDefaultValue = true)]
        public string DomainName { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("class Marketplace {\n");
            sb.Append("  Id: ").Append(Id).Append("\n");
            sb.Append("  Name: ").Append(Name).Append("\n");
            sb.Append("  CountryCode: ").Append(CountryCode).Append("\n");
            sb.Append("  DefaultCurrencyCode: ").Append(DefaultCurrencyCode).Append("\n");
            sb.Append("  DefaultLanguageCode: ").Append(DefaultLanguageCode).Append("\n");
            sb.Append("  DomainName: ").Append(DomainName).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public virtual string ToJson()
        {
            return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            if (this.CountryCode != null) {
                // CountryCode (string) pattern
                Regex regexCountryCode = new Regex(@"^([A-Z]{2})$", RegexOptions.CultureInvariant);
                if (!regexCountryCode.Match(this.CountryCode).Success)
                {
                    yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for CountryCode, must match a pattern of " + regexCountryCode, new [] { "CountryCode" });
                }
            }

            yield break;
        }
    }

}
